package cn.funeralobjects.ams.entity;

import cn.funeralobjects.common.annotations.Code;
import cn.funeralobjects.common.annotations.Enable;
import cn.funeralobjects.common.annotations.Name;
import cn.funeralobjects.util.converter.DefaultBooleanShortConverter;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.persistence.*;

/**
 * @author FuneralObjects
 * Create date: 2020/5/25 11:01 AM
 */
@Data
@Accessors(chain = true)
@Table(name = "t_product_res")
@Entity
public class EProductRes {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;
    /**
     * 编码
     */
    @Code
    private String code;
    /**
     * 名称
     */
    @Name
    private String name;
    /**
     * 是否启用禁用
     */
    @Convert(converter = DefaultBooleanShortConverter.class)
    @Enable
    private Boolean enable;

    /**
     * 所属产品
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "product_id")
    private EProduct product;

    /**
     * 所属区域
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "region_id")
    private ERegion region;
}
